Devise: undefined method `user_signed_in?' for ApplicationController:Class?

So I'm marking this as a community wiki since the solution is trivial.

Up vote 0 down vote favorite share g+ share fb share tw.

I'm getting the above error with Rails 3.1.1 and Ruby 1.9.2. I've spent the last hour looking and the main things I've found were: clear_helpers in ApplicationController can cause the helpers to not load. My code isn't using that and I don't believe the gems I've installed are either.

Missing devise_for in routes.rb. I have devise_for :users Missing 'database_authenticatable' in my Users model. I have in my users.

Rb : devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable My behavior matches exactly what's described in this email thread except signed_in? :user doesn't work for me either. However, Devise.

Mappings does show the user mapping. Any ideas on what could be wrong? Even a hack for current_user would help me greatly as I have to get some functionality running ASAP.

Ruby-on-rails devise link|improve this question asked Oct 13 '11 at 21:44Eric Hu1,058621 76% accept rate.

So I'm marking this as a community wiki since the solution is trivial. I was calling debugger (which I used to check current_user with the following code class ApplicationController . Long story short, make sure you're not trying to call it within a controller definition but within the controller instance.

Number 3 strikes me as odd. Is your model file named users. Rb?

Is your class declaration Users user. Rb User.

It's actually user. Rb and that was a typo on my part. Good eye, though.

It actually was working and I was calling current_user and user_signed_in? In the wrong context – Eric Hu Oct 13 '11 at 22:12 What do you mean by wrong context? – Ken Oct 13 '11 at 22:54 See my answer above.

I was calling it in the declaration of a controller instead of within an instance of a controller. – Eric Hu Oct 14 '11 at 2:19.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions